package com.xyz;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MainApp {
    public static void main(String[] args) {
        // 应用容器获取 bean 配置，创建上下文容器对象
        ApplicationContext context =
                new ClassPathXmlApplicationContext("Beans.xml");
        // 通过 spring 获取学生 bean
        Student student = (Student) context.getBean("student");
        // 调用取值器
        student.getName();
        student.getAge();
        // 调用打印异常的方法
        student.printThrowException();
    }
}
